# 线性脚本


from time import sleep

from numpy.ma.testutils import assert_equal
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select

driver=webdriver.Chrome()
driver.maximize_window()
print('开始进入网页')
url='https://mapify.so/cn'
driver.get(url)
driver.implicitly_wait(20)
text1=driver.find_element(By.XPATH,'//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
text2=driver.find_element(By.XPATH,'//span[contains(@class,"text-pretty text-sm leading-5")]').text
head_total_left=driver.find_element(By.XPATH,'//div[@class="flex flex-row gap-6"]/div[1]')
head_left_btn1=driver.find_element(By.XPATH,'//div[@class="flex flex-row gap-6"]/div/a[1]')
head_left_btn2=driver.find_element(By.XPATH,'//div[@class="flex flex-row gap-6"]//span')
head_left_btn3=driver.find_element(By.XPATH,'//div[@class="flex flex-row gap-6"]/div/a[2]')
head_left_btn4=driver.find_element(By.XPATH,'//div[@class="flex flex-row gap-6"]/div/a[3]')

head_total_right=driver.find_element(By.XPATH,'//div[@class="flex flex-row gap-2"]')
head_right_btn1=driver.find_element(By.XPATH,'//div[@class="flex flex-row gap-2"]/a[1]')
head_right_btn2=driver.find_element(By.XPATH,'//div[@class="flex flex-row gap-2"]/a[2]')

start_btn=driver.find_element(By.XPATH,'//a[contains(@class,"box-shadow-06 ")]')

# 点击语言选择按钮
print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
sleep(3)


print('开始检测页面默认中文')
assert (text1=='AI 思维导图总结工具' )
        # and text2=='仅需几秒即可将 YouTube、PDF/文档、网址、长邮件、会议录音 总结成思维导图。由 GPT-4o、Claude 3.5 或其他顶级 LLM 驱动。免费开始使用')
# 点击选择第一个语言
print('开始选择第一个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[1]').click()
sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='AI Mind Map Summarizer')
    print('文本断言成功')
except:
    print('第一个语言文本断言异常')
        # and text2=='Summarize YouTube, PDFs/Docs, URLs, Long Emails,Meeting Recordings into Mind Maps in seconds.Powered by GPT-4o, Claude 3.5, or other top LLMs.')
# print('进入for循环前')
# for i in range(1,16):
#     print('for循环中')
#     print(f'开始选择第{i}个语言')
#     driver.find_element(By.XPATH, '(//span[@class="flex-1"])[i]').click()
#     sleep(3)

print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第2个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[2]').click()
sleep(3)
try:
    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='AI マインドマップ要約ツール')
    print('文本断言成功')
except:
    print('第2个语言文本断言异常')

print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第3个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[3]').click()
sleep(3)
try:
    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='Ringkasan Peta Pikiran AI')
    print('文本断言成功')
except:
    print('第3个语言文本断言异常')


print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第4个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[4]').click()
sleep(3)
try:
    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='KI Mindmap Zusammenfasser')
    print('文本断言成功')
except:
    print('第4个语言文本断言异常')

print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第5个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[5]').click()
sleep(3)
try:
    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='Resumen de Mapa Mental con IA')
    print('文本断言成功')
except:
    print('第5个语言文本断言异常')

print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第6个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[6]').click()
sleep(3)
try:
    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='Résumeur de Carte Mentale IA')
    print('文本断言成功')
except:
    print('第6个语言文本断言异常')

print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第7个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[7]').click()
sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='Resumidor de Mapas Mentais com IA')
    print('文本断言成功')
except:
    print('第7个语言文本断言异常')

print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第8个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[8]').click()
sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='AI Zihin Haritası Özetleyici')
    print('文本断言成功')
except:
    print('第8个语言文本断言异常')

print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第9个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[9]').click()
sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='AI 思维导图总结工具')
    print('文本断言成功')
except:
    print('第9个语言文本断言异常')

print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第10个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[10]').click()
sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='AI 心智圖摘要器')
    print('文本断言成功')
except:
    print('第10个语言文本断言异常')


print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第11个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[11]').click()
sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='AI 마인드 맵 요약기')
    print('文本断言成功')
except:
    print('第11个语言文本断言异常')


print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第12个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[12]').click()
sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='AI माइंड मैप सारांशक')
    print('文本断言成功')
except:
    print('第12个语言文本断言异常')


print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第13个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[13]').click()
sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='Суммаризатор ментальных карт на базе ИИ')
    print('文本断言成功')
except:
    print('第13个语言文本断言异常')


print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第14个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[14]').click()

sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='สรุปด้วยแผนที่ความคิด AI')
    print('文本断言成功')
except:
    print('第14个语言文本断言异常')


print('开始查找切换语言按钮')
driver.find_element(By.XPATH,'//button[contains(@class,"text-fg-01-light")]').click()
print('开始选择第15个语言')
driver.find_element(By.XPATH,'(//span[@class="flex-1"])[15]').click()
sleep(3)
try:

    text1 = driver.find_element(By.XPATH, '//h1[contains(@class,"mt-4 whitespace-pre-line")]').text
    print(text1)
    assert (text1=='Trình tóm tắt Sơ đồ tư duy AI')
    print('文本断言成功')
except:
    print('第15个语言文本断言异常')